package model.houseproject_commity.mapper;

import com.github.pagehelper.PageInfo;
import model.houseproject_commity.entity.Commity;
import org.apache.ibatis.annotations.*;

import java.util.List;


/**
 * Created by ws on 2019/6/23.
 */
@Mapper
public interface CommityMapper {
 @Select("select * from commity")
    List<Commity> findAlls();
  @Insert("insert into commity values(#{id},#{commityid},#{commityname},#{imgurl},#{agentid},#{averageprice},#{commityaddress},#{sellnumber})")
  void save(Commity commity);
  @Delete("delete from commity where id=#{id}")
  void del(Integer id);
  @Update("update commity set id=#{id},commityid=#{commityid},commityname=#{commityname},imgurl=#{imgurl},agentid=#{agentid},averageprice=#{averageprice},commityaddress=#{commityaddress},sellnumber=#{sellnumber} where id=#{id}")
  void update(Commity commity);
  //@Select("select * from commity where id=#{id}")
   Commity findid(Integer id);
  @Select("select * from commity where subway like concat('%',#{subway},'%')")
  List<Commity> findAll(String subway);
  PageInfo<Commity> getPageInfo();
  @Select("select * from commity where commityaddress like concat('%',#{subway},'%')")
  List<Commity> findaddress(String address);
  @Select("select * from commity where type like concat('%',#{type},'%')")
  List<Commity> findtype(String type);
  @Select("select * from commity where type like concat('%',#{type},'%')")
  List<Commity> findaveprice(String averageprice);
  @Select("select * from commity where type=#{type} or subway=#{subway} or commityaddress=#{commityaddress}")
  List<Commity> checkboxfind(@Param("commityaddress") String commityaddress,@Param("type") String type,@Param("subway") String subway);
}
